﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ClassifierLib
{
    /// <summary>
    /// Action factory type, used for creating new actions in classifiers without explicit knowledge of how they are constructed
    /// </summary>
    public class ActionFactory
    {
        public virtual Action Instance()
        {
            throw new NotImplementedException();
        }
    }

    /// <summary>
    /// Action factory for discrete outputs
    /// </summary>
    class DiscreteActionFactory : ActionFactory
    {
        /// <summary>
        /// Number of output states
        /// </summary>
        public int OutputCount
        {
            get;
            set;
        }

        public override Action Instance()
        {
            return new Action(PersistantRandom.Instance.Next(OutputCount));
        }
    }

    /// <summary>
    /// Action factory for discrete outputs
    /// </summary>
    class ContinuousActionFactory : ActionFactory
    {
        public override Action Instance()
        {
            return new Action(PersistantRandom.Instance.NextDouble());
        }
    }


    /// <summary>
    /// Action factory for discrete outputs
    /// </summary>
    class MultiplexerActionFactory : ActionFactory
    {
        //Will: how should this work for a multiplexer? This code is used to generate Actions for mutated rules, and for rules added during cover phase. Should they also have outputs related to the binary value of their conditions??
        public override Action Instance() 
        {
            return new Action(PersistantRandom.Instance.Next(2));
        }
    }

}
